home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 35 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: lyra.csx.cam.ac.uk!nmm1
  2. From: nmm1@cus.cam.ac.uk (Nick Maclaren)
  3. Newsgroups: comp.std.c,comp.lang.c
  4. Subject: Re: K&R to ANSI converters
  5. Date: 5 Jan 1996 20:31:28 GMT
  6. Organization: University of Cambridge, England
  7. Message-ID: <4ck1r0$1eo@lyra.csx.cam.ac.uk>
  8. References: <4cjqt9$sjq@newsgate.sps.mot.com>
  9. NNTP-Posting-Host: bootes.cus.cam.ac.uk
  10.  
  11. In article <4cjqt9$sjq@newsgate.sps.mot.com>, Kevin Brune  <brune> wrote:
  12. >I am looking for any tools (free, shareware or commercial) that 
  13. >would help me in a large K&R to ANSI C conversion/porting project.
  14. >
  15. >Any Web addresses or ftp site addresses would be appreciated.  I
  16. >am interested in tools that will run on UNIX platforms: (Sun under
  17. >SunOS 4.1.3 or Solaris 2.5 and HP under HPUX 9.03) Thanks
  18. >for your help!
  19.  
  20. You may be asking the impossible.  Most clean K&R C will compile and run
  21. correctly under an ANSI compiler, with very few (if any) changes.  There
  22. are three reasons that you might want to use such a converter:
  23.  
  24.     1) To take clean K&R C and convert it to using prototypes, extra
  25. casts, and so on.  This should be feasible.
  26.  
  27.     2) To take unclean K&R C and convert it to something that will
  28. compile under an ANSI compiler.
  29.  
  30.     3) To take unclean K&R C and fix up the semantic differences, so
  31. that it executes correctly under an ANSI compiler.
  32.  
  33. The reason that I say that the latter two categories are unclean K&R
  34. C is that 99% of the incompatibilities between K&R C and ANSI C are
  35. things that no right-minded programmer would rely on.  The reasons that
  36. ANSI had to change them were precisely because different implementations
  37. handled them differently and because they were virtually impossible to
  38. define correctly.
  39.  
  40. I don't give you the chance of a flea in a furnace of finding any
  41. utilities that will do the job without exposing you to the serious
  42. risk of errors introduced by the translation.  My experience of such
  43. conversions is that I cannot even define general rules for conversion,
  44. let alone work out how to program them!  And I have done quite a lot
  45. of this.
  46.  
  47. But there may well be something that will handle the first category.
  48.  
  49.  
  50. Nick Maclaren,
  51. University of Cambridge Computer Laboratory,
  52. New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
  53. Email:  nmm1@cam.ac.uk
  54. Tel.:  +44 1223 334761    Fax:  +44 1223 334679
  55.